<template>
  <div>
    <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-row :gutter="24">
        <a-col :span="8">
          <a-form-model-item label="订单状态">
            <a-select v-model="dataForm.status">
              <a-select-option v-for="item of statusList" :key="item.key">
                {{ item.name }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="订单号">
            <a-input v-model="dataForm.orderNo" allowClear :maxLength="100"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="订单名称">
            <a-input v-model="dataForm.orderName" allowClear :maxLength="100"/>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="24">
        <a-col :span="8">
          <a-form-model-item label="申请部门">
            <a-input v-model="dataForm.applyDeptName" allowClear />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="订单类型">
            <a-select v-model="dataForm.orderType" placeholder="请选择">
              <a-select-option v-for="(item, index) in orderTypeList" :key="index" :value="item.code">
                {{item.name}}
              </a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="制作人/制作单位">
            <a-input v-model="dataForm.designerName" allowClear />
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
  </div>
</template>
<script>
  import {codeInfoList} from '@/api/codeInfo'
export default {
  name: 'AdvancedSearch',
  props: {
    dataForm: {},
  },
  data() {
    return {
      labelCol: { span: 8 },
      wrapperCol: { span: 15 },      
      form: {},
      statusList: [
        { name: '审核中', key: '2' },
        { name: '制作中', key: '3' },
        { name: '确认中', key: '4' },
        { name: '创建中', key: '1' },
        { name: '已完成', key: '5' },
        { name: '不通过', key: '6' },
        { name: '已作废', key: '7' },
      ],
      orderTypeList:[],
    }
  },
  watch: {
    dataForm: {
      handler(val, oldVal) {
        this.form = val
      },
      deep: true,
      immediate: true,
    },
  },
  mounted() {
    codeInfoList({type:'素材-订单类型',pageSize:-1,isdel: 0}).then((res) => {
      if (res.code == 200) {
        this.orderTypeList = res.result.records
      } else {
        this.$message.warning('操作异常:' + res.message)
      }
    }).catch((res) => {
      this.$message.warning('操作异常:' + res.message)
    })
  },
  methods: {
    resetForm(){
      this.dataForm.status = undefined
      this.dataForm.orderNo = ''
      this.dataForm.orderName = ''
      this.dataForm.applyUserName = ''
      this.dataForm.orderType = undefined
      this.dataForm.designerName = ''
    }
  },
}
</script>
<style lang="less" scoped></style>
